<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">  
  <title>鲜花列表</title>
 </head>
 <body>
 
 <?php
  require_once('search.php');

  // connect();
  // //编写sql语句
  // $sql = 'select * from flower';
  // $key=array();
  // if($_POST['key'])  {
  //   $key = trim($_POST['key']);
  //   $sql = $sql." where xjn_title like '%{$key}%' ";
  // }
  // //echo $sql.'<br/>';  
  // $result = fetch_array($sql); 
   
 ?>

 <center><h3>鲜花列表</h3></center>
 <table align="center" width="80%" border=1> 
 <tr>
   <th>编号</th>
   <th>鲜花标题</th> 
   <th>鲜花产地</th> 
   <th>鲜花添加时间</th>   
   <th >点击量</th>
   <th>操作</th>
 </tr>

 <?php
  foreach ($result as $row) {
   echo '<tr>';
   echo '<td>'.$row['xjn_id'].'</td>';
   echo '<td><a href="detail.php?id='.$row['xjn_id'].' ">'.$row['xjn_title'].'</a> </td>'; 
   echo '<td>'.$row['xjn_place'].'</td>';
   echo '<td>'.$row['xjn_adddate'].'</td>';
   echo '<td>'.$row['xjn_hint'].'</td>';
   echo '<td><a href="flowerEditForm.php?id='.$row['xjn_id'].' ">修改</a> | 
   <a href="delflower.php?id='.$row['xjn_id'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a></td>';
   echo '</tr>';  
  }
  echo '</table>';  
  $totalrows = count($result);
  echo "<table align='center'><tr><td>共有{$totalrows}种花</td></tr></table>";   
 ?>
 
 </body>
</html>